package server.io.game.conn;

import java.nio.channels.SelectionKey;

import server.io.client.ClientInfo;

public abstract class NetModuleNIO extends NetModuleBase
{

	
	
	/**
	 * 取出附带的内容
	 * @param selectKey
	 * @param key
	 * @return
	 */
	public Object getAttach(SelectionKey selectKey, String key)
	{
		Object _result = null;
		ClientInfo _attach = (ClientInfo) selectKey.attachment();
		_result = _attach.map.get(key);
		return _result;
	}

	/**
	 * 更新附带的内容
	 * @param selectKey
	 * @param key
	 * @return
	 */
	public void putAttach(SelectionKey selectKey, String key, Object value)
	{
		ClientInfo _attach = (ClientInfo) selectKey.attachment();
		_attach.map.put(key, value);
	}
	
	/**
	 * 拿出clientinfo
	 * @param aKey
	 * @return
	 */
	public ClientInfo getClientInfo(SelectionKey aKey)
	{
		ClientInfo _result = null;
		_result = (ClientInfo) aKey.attachment();
		return _result;
	}
	
	
	
}
